<?php


namespace app\index\business;


use app\common\lib\Num;
use app\common\lib\sms\TencentSms;

class smsBus
{
    public static function sendCode($phone){
        $code = Num::getCode('6');
        $sms = TencentSms::sendCode($phone,$code);
        $sessionData = [
            'code' => $code,
            'phone' => $phone
        ];
        if($sms->SendStatusSet[0]->Fee == 1){
            session(config('index.session_send_code'),$sessionData);
            return true;
        }else{
            return false;
        }
    }
    public static function sendCodePassword($phone){
        $code = Num::getCode('6');
        $sms = TencentSms::sendCode($phone,$code);
        $sessionData = [
            'code' => $code,
            'phone' => $phone
        ];
        if($sms->SendStatusSet[0]->Fee == 1){
            session(config('index.password_change_code'),$sessionData);
            return true;

        }else{
            return false;
        }
    }

    public static function tencentSendCodeBus($phone){
        $code = Num::getCode('6');
        $sms = TencentSms::sendCode($phone,$code);
        $sessionData = [
            'code' => $code,
            'phone' => $phone
        ];
        if($sms->SendStatusSet[0]->Fee == 1){
            session(config('index.session_send_code'),$sessionData);
            return true;
        }else{
            return false;
        }
    }
}